package layeredcontent.views
{
	import flash.events.Event;
	import flash.geom.Rectangle;
	
	import mx.controls.HTML;
	import mx.core.Window;
	import mx.events.AIREvent;
	
	import withincode.ui.WindowUtils;

	public class WebContainer extends Window
	{
		public var html:HTML;
		public var location:String;
		
		public function WebContainer(name:String, location:String)
		{
			this.name = name;
			this.location = location;
			addEventListener(AIREvent.WINDOW_COMPLETE, creationCompleteHandler);
		}
		
		
		protected override function createChildren():void
		{
			super.createChildren();
			html = new HTML();
			html.percentWidth = html.percentHeight = 100;
			html.location = location;
			addChild(html);
		}
		
		private function creationCompleteHandler(event:Event):void
		{
			WindowUtils.registerWindow(name, nativeWindow, new Rectangle(0, 0, 800, 600));
		}
	}
}